﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Linq;

namespace TRIG_MOD_STATUSSUMMARY.DocTypeStatusSummary
{
    public partial class DocTypeStatusSummaryUserControl : UserControl
    {
        DataForStatusSummary objCls = new DataForStatusSummary();

        List<string> docTypes = new List<string>();
        List<string> discipAbb = new List<string>();

        public List<string> DocTypes
        {
            get { return docTypes; }
            set { docTypes = value; }
        }

        public List<string> Disciplines
        {
            get { return discipAbb; }
            set { discipAbb = value; }
        }

        RadioButtonList rdDates = new RadioButtonList();

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                rdDates.SelectedValue = "10";
                objCls.rdDates = rdDates;
                NullLabels();
                docTypes = objCls.GetDocumentType(ddlDocsTypes);
                discipAbb = objCls.GetDiscipiline();
                //objCls.GridCSS(stSumGrid);
                objCls.CreateTable();
                if (objCls.ckItemsInDocs("METHOD STATEMENTS (FLOW IS DIFFERENT, DESCRIBED LATER)") > 0)
                {
                    objCls.GetDocItemsbyDiscipiline("METHOD STATEMENTS (FLOW IS DIFFERENT, DESCRIBED LATER)", Disciplines, errorMessage, "consultant");
                }
                //string s = "METHOD STATEMENTS (FLOW IS DIFFERENT, DESCRIBED LATER";
                //char ss = s.FirstOrDefault(c => Char.IsWhiteSpace(c));
                //s = s[0].ToString() + s[ss].ToString();

                objCls.BindGrid(stSumGrid, lbl_R1, lbl_R2, lbl_R3, lbl_R4,lbl_R4, "consultant");

                string p = "% of MSs ";
                lblr1.Text = "Under Review" + p + lblr1.Text;
                lblr2.Text = "Approved (Code : 1) as per total submitted" + p + lblr2.Text;
                lblr3.Text = "Approved as noted (Code : 2) as per total submitted" + p + lblr3.Text;
                lblr4.Text = "Not Approved (Code : 3) as per total submitted" + p + lblr4.Text;

            }
            catch (Exception x)
            {

                errorMessage.Text += x.Message;
            }


        }

        private void NullLabels()
        {
            lblr1.Text = ""; lblr2.Text = ""; lblr3.Text = ""; lblr4.Text = ""; lbl_R1.Text = ""; lbl_R2.Text = ""; lbl_R3.Text = ""; lbl_R4.Text = "";
            errorMessage.Text = "";
            stSumGrid.Visible = true;
        }
    }
}
